-- 显示血量和暴击,自制的简单实例

print('Dino.lua is running!')
mem = manager.machine.devices[':maincpu'].spaces['program']
container = manager.machine.render.ui_container
--container = manager.machine.screens[":screen"].container

power_x = 0.3
power_y = 0.11
hp_x = 0.335
hp_y = 0.07
font_color = 0xFFffff00
power_addr = 0xFFB33A
hp_addr = 0xFFB2E1

function showPower()
  local power = string.format("%X", mem:read_u8(power_addr))
  container:draw_text(power_x, power_y, power, font_color)
end

function showHp()
  local hp = string.format("%d", mem:read_u8(hp_addr))
  container:draw_text(hp_x, hp_y, hp, font_color)
end

function main()
  showPower()
  showHp()
end

emu.register_frame_done(main, "frame")
